//
//  IndexViewCell.m
//  FHC
//
//  Created by alex on 15/2/11.
//  Copyright (c) 2015年 alex. All rights reserved.
//

#import "IndexViewCell.h"
#import "XXTool.h"
#import <QuartzCore/QuartzCore.h>

@implementation IndexViewCell
{
    UIView *imgCen;
    UIView *contentOne;
}


-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        self.backgroundColor = [UIColor clearColor];
        CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
        CGFloat imgH = [UIScreen mainScreen].bounds.size.width*(155+48+3)/375;
        
        self.frame = CGRectMake(0
                                , 0
                                , screenWidth-15
                                , imgH);
       
        
        _img = [[UIImageView alloc] initWithFrame:CGRectMake(15/2
                                                             ,0
                                                             ,[UIScreen mainScreen].bounds.size.width
                                                             , [UIScreen mainScreen].bounds.size.width*155/375-15)];
        [_img setContentMode:UIViewContentModeScaleAspectFill];
        _img.userInteractionEnabled = YES;
        _img.clipsToBounds = YES;
        [self addSubview:_img];
        
        imgCen = [[UIView alloc] init];
        imgCen.backgroundColor = [XXTool colorWithProject];;
        imgCen.alpha=0.9;
        [self addSubview:imgCen];
        
        _yin=[[UIView alloc] init];
        _yin.backgroundColor=[UIColor colorWithRed:217/255.0 green:217/255.0 blue:217/255.0 alpha:1.0];
        [self addSubview:_yin];
        
        
        _lab = [[UILabel alloc] init];
        _lab.font = [XXTool systemFontOfSize:16];
        //_lab.textAlignment=UITextAlignmentLeft;
        _lab.textColor = [UIColor whiteColor];
        _lab.numberOfLines = 2;
        [imgCen addSubview:_lab];
        
    }
    return self;
}

-(void)initImageView:(NSString *)imgUrl andLabelView:(NSString *)text
{
    
    CGFloat imgH = [UIScreen mainScreen].bounds.size.width*150/375;

    self.frame = CGRectMake(0
                            , 0
                            , [UIScreen mainScreen].bounds.size.width
                            , imgH);
    

    imgCen.frame = CGRectMake(0
                              , imgH-imgH*45/150
                              , [UIScreen mainScreen].bounds.size.width
                              , imgH*45/150);
    
    [_img setImageWithUrl:imgUrl];
    
    _img.frame = CGRectMake(0
                            , 0
                            ,[UIScreen mainScreen].bounds.size.width
                            , imgH);
    
//    _yin.frame=CGRectMake(0, imgCen.frame.origin.y, [UIScreen mainScreen].bounds.size.width, 1);
////    _yin.layer.masksToBounds = NO;
//    [[_yin layer] setShadowColor:[UIColor colorWithRed:217/255.0 green:217/255.0 blue:217/255.0 alpha:1.0].CGColor];
//    //[[_yin layer] setShadowColor:[UIColor blackColor].CGColor]; // 阴影的颜色
//    [[_yin layer] setShadowOffset:CGSizeMake(0, 2)]; // 阴影的范围
//    [[_yin layer] setShadowRadius:2];                // 阴影扩散的范围控制
//    [[_yin layer] setShadowOpacity:0.9];               // 阴影透明度
    
    [_lab setText:text];
    
    CGFloat labHe=[XXTool getTextHeightByText:_lab.text Font:_lab.font Width:imgCen.frame.size.width-50];
    _lab.frame = CGRectMake(15
                            , (imgCen.frame.size.height-labHe)/2
                            , [UIScreen mainScreen].bounds.size.width-50
                            , labHe);
    
}



@end
